package org.gruposp2p.dnie.server.rest;

import javax.ws.rs.DELETE;
import javax.ws.rs.PathParam;
import javax.ws.rs.core.Response;
import org.gruposp2p.dnie.service.DNIeSignedDocumentOptionSelectedDAO;
import org.springframework.stereotype.Component;
import org.springframework.context.annotation.Scope;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

/**
 *
 * @author jj
 */
@Component
@Scope("request")
public class DnieSignedDocumentOptionSelectedResource {

    private static Logger logger =
            LoggerFactory.getLogger(DnieSignedDocumentOptionSelectedResource.class);

    @Autowired
    DNIeSignedDocumentOptionSelectedDAO signedDocumentOptionSelectedDao;

    @DELETE
    public Response delete (@PathParam("documentId") Integer documentId) {
        if (signedDocumentOptionSelectedDao.delete(documentId)) {
            return Response.ok().build();
        } else {
            return Response.status(Response.Status.NOT_FOUND).build();
        }
    }

}
